SlideShare a Scribd company logo
1 of 51
Download to read offline
How to
make
                   libraries
                   work for you
  Simon Willison - http://simonwillison.net/
        Web 2.0 Expo Berlin
           7th November 2007
This talk

ā€¢ JavaScript libraries!
ā€¢ What they are
ā€¢ Why they exist
ā€¢ What they can do for you
ā€¢ How to pick one
JavaScript libraries

ā€¢   ajaxpatterns.org lists over 40 general purpose
    JavaScript libraries

    ā€¢   ... and thatā€™s not including the many libraries tied
        to a speciļ¬c server-side language

ā€¢   Why are there so many of them?
ā€œThe bad news:
JavaScript is broken.
    The good news:
 It can be ļ¬xed with
  more JavaScript!ā€
              Geek folk saying
ā€¢   Inconsistent event model (thanks, IE)
ā€¢   Memory management (thanks, IE)
ā€¢   The DOM is a horrible API!
ā€¢   JavaScript-the-language has quite a few warts
    ā€¢   But itā€™s powerful enough to let you ļ¬x them
ā€¢   Browser Ajax is far too verbose
ā€¢   Positioning and co-ordinates
ā€¢   Drag and drop and Animation are really hard
var xhr;
if (window.XMLHttpRequest) {
    xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) {
    try {
        xhr = new ActiveXObject('Microsoft.XMLHTTP');
    } catch (e) {}
}
xhr.onreadystatechange = function() {
   if (xhr.readyState == 4) {
        if (xhr.status == 200) {
            alert(xhr.responseText);
        } else {
            alert('Error code ' + xhr.status);
        }
    }
}
Narrowing them down...

ā€¢ Prototype (and Scriptaculous)
ā€¢ The Yahoo! User Interface Library - YUI
ā€¢ jQuery
ā€¢ The Dojo Toolkit
Download
                                                            Get the latest versionā€”1.5.1


                                                            Learn
Prototype is a JavaScript Framework that aims to            Online documentation and resources.
ease development of dynamic web applications.
Featuring a unique, easy-to-use toolkit for class-driven    Discuss
development and the nicest Ajax library around, Prototype   Mailing list and IRC
is quickly becoming the codebase of choice for web
application developers everywhere.
                                                            Contribute
                                                            Submit patches and report bugs.


   Prototype and Scriptaculous
Prototype and script.aculo.us: The quot;Bungee
bookquot; has landed!

                    Core team member Christophe
                                                            Who's using Prototype?
                                                            Meet the developers

                    Porteneuve has been hard at work
                    for the past few months tracking
ā€¢ Prototype focuses on basic browser
  compatibility and JavaScript language
  enhancement

ā€¢ It tries to make JavaScript more like Ruby
ā€¢ Extends most of JavaScriptā€™s built-in objects
  with new functionality

ā€¢ Scriptaculous adds fancy effects, basic
  widgets and drag and drop
ā€¢ $, $$, $F, $A, $H
ā€¢ var Animal = Class.create(...)
ā€¢ new Ajax.Request(url[, options])
ā€¢ Event.observe(el, 'click', function() { ... })
ā€¢ quot;foo-barquot;.camelize() -> quot;fooBarquot;
$$('#bmarks li').each(function(li){
  Event.observe(li, 'click', function(e) {
    this.style.backgroundColor = 'yellow';
  }.bindAsEventListener(li));
});
Script.aculo.us

ā€¢ Wizzy extension for Prototype
ā€¢ Huge collection of packaged effects
ā€¢ AutoComplete, Slider, InPlaceEditor controls
ā€¢ Drag and drop
The Yahoo UI Library
ā€¢ Created at Yahoo!, BSD licensed
ā€¢ Designed for both creating new applications
  and integration with legacy code

ā€¢ Focused on browser issues; almost no
  functionality relating to JS language itself

ā€¢ Extensively tested and documented
controls

autocomplete      calendar        container


  menu           slider          treeview



    animation                dragdrop


  dom           event           connection

                utilities
YAHOO.util.Event.on(window, 'load', function() {
	

 var div = YAHOO.util.Dom.get('messages');
	

 setTimeout(function() {
	

 	

 var anim = new YAHOO.util.Anim(div, {
	

 	

 	

 height: {to: 0},
	

 	

 	

 opacity: {to: 0}
	

 	

 }, 0.4);
	

 	

 anim.animate();
	

 	

 anim.onComplete.subscribe(function() {
	

 	

 	

 div.parentNode.removeChild(div);
	

 	

 });
	

 }, 2000);
});
Common YUI idiom

$E = YAHOO.util.Event;
$D = YAHOO.util.Dom;

$E.on(window, 'load', function() {
	

 var div = $D.get('messages');
    ...
});
jQuery
ā€¢   Simple philosophy: ļ¬nd some nodes, then do
    something to them

ā€¢   Minimal impact on your global namespace - it adds
    two global symbols: jQuery and $, and $ can be easily
    reverted

ā€¢   API designed around ā€œchainingā€ - other libraries are
    now emulating this

ā€¢   Outstanding node selection, based on CSS 3 and
    custom extensions

ā€¢   Small core library with a smart plugin mechanism
jQuery(window).ready(function() {
  jQuery(quot;div.hideablequot;).
    css('cursor', 'pointer').
    append('<p>Click to hide</p>').
    click(function() {
      jQuery(this).hide(quot;slowquot;);
      return false;
    });
});
$(function() {
  $(quot;div.hideablequot;).
    css('cursor', 'pointer').
    append('<p>Click to hide</p>').
    click(function() {
      $(this).hide(quot;slowquot;);
      return false;
    });
});
The Dojo Toolkit
ā€¢ The oldest of the current popular libraries,
  pre-dating even the term ā€œAjaxā€

ā€¢ Incredible amounts of functionality
ā€¢ Used to suffer from a tough learning curve,
  but the 1.0 release greatly simpliļ¬es things
dojo.collections         dojo.math

dojo.crypto              dojo.reļ¬‚ect

dojo.date                dojo.rpc

dojo.dnd                 dojo.storage

dojo.dom                 dojo.string

dojo.event         Dojo 0.4
                         dojo.style

dojo.io                  dojo.undo

dojo.lang                dojo.uri

dojo.lfx                 dojo.widget

dojo.logging             dojo.xml

                                http://www.ļ¬‚ickr.com/photos/aprillynn77/8818200/
dojo


        Dojo 1.0

dojox              dijit
Dojo components
ā€¢ dojo
 ā€¢ Core library, similar to jQuery / Prototype
 ā€¢ Dynamic code loading and dependency
    management
ā€¢ dijit
 ā€¢ Advanced widget system
ā€¢ dojox
 ā€¢ Dojo eXperimental - crazy voodoo magic
dijit
<div dojoType=quot;dijit.layout.TabContainerquot; sizeShare=quot;40quot;>
<div id=quot;tab1quot;
 dojoType=quot;dijit.layout.ContentPanequot; title=quot;Form Feelquot;>
  <h2>Various Form Elements:</h2>
    <form name=quot;dijitFormTestquot;>
<p><input type=quot;checkBoxquot;
     dojoType=quot;dijit.form.CheckBoxquot; checked=quot;checkedquot;>
Standard Dijit CheckBox
<br><input type=quot;checkBoxquot;
     dojoType=quot;dijit.form.CheckBoxquot; disabled=quot;disabledquot;>
Disabled Dijit
<br>
<input type=quot;checkBoxquot;
     dojoType=quot;dijit.form.CheckBoxquot; disabled=quot;disabledquot;
    checked=quot;checkedquot;>
Checked and Disabled Dijit
</p>
...
dojox
ā€¢ Graphics (cross-browser drawing API)
ā€¢ Ofļ¬‚ine storage
ā€¢ Cryptography
ā€¢ Templating
ā€¢ Data grids and more
ā€¢ ā€œThe future of the browser todayā€
Honourable mentions
Ext JS
The Google Web Toolkit
What are the interesting ideas?
Interaction Design Patterns
Smart node selection

ā€¢   Any JavaScript that modiļ¬es the page inevitably
    starts out by selecting some existing nodes

ā€¢   jQuery is based entirely around node selection

ā€¢   Prototype and Dojo also have node selection APIs
Smarter Ajax
ā€¢ Prototype makes it easy to set a callback for
  when ANY Ajax request completes... useful
  for loading status icons


ā€¢ Ajax.Updater can extract and execute
  <script> blocks in HTML fragments
ā€¢ Great for unobtrusively enhancing elements
  that have just been added to the page
Self-adjusting animations
ā€¢ You can roll your own animations in
  JavaScript using setTimeout and setInterval...
ā€¢ ... but the time taken for a animation will
  vary depending on browser performance
ā€¢ Smarter animations adjust their framerate to
  compensate for browser performance
ā€¢ All four libraries do this
DSLs for animation
var anim = new YAHOO.util.Anim('el', {
  opacity: {to: 0.5},
  height: {to: 0},
  fontSize: {
    from: 100, to: 50, unit: '%'
  }
}, 1);
anim.animate();
XPath optimisations

ā€¢ Mozilla and Opera offer fast XPath lookups
  through document.evaluate(...)
ā€¢ Dojo can use this for getElementsByClass()
ā€¢ Prototype redeļ¬nes getElementsBySelector
  to use XPath
Miniļ¬cation
ā€¢ All four libraries ship in both uncompressed
  and compressed formats
ā€¢ YUI uses miniļ¬cation: whitespace and
  comments are stripped
ā€¢ The Dojo build system uses ā€œShrinkSafeā€,
  which compresses JavaScript using the Rhino
  parser
ā€¢ jQuery uses Dean Edwardsā€™ Packer, with
  base62 encoding
Hosting on a CDN
    http://yui.yahooapis.com/2.2.2/build/reset/reset-min.css
    http://yui.yahooapis.com/2.2.2/build/dom/dom-min.js
    ...
    http://o.aolcdn.com/iamalpha/.resource/jssdk/dojo-0.4.1/dojo.js



ā€¢    JavaScript is cached before the user even visits your site
So how do you pick one?
So how do you pick one?



ā€¢ It depends on what you are trying to build
My library selection criteria

ā€¢ Enables unobtrusive JavaScript
ā€¢ Plays well with other code
 ā€¢ Smart use of namespacing
 ā€¢ Global variable impact kept to a minimum
ā€¢ Tie breaker: the less code I have to write the
  better!
ā€¢ Iā€™m currently using and recommending
  jQuery for most situations

ā€¢ But... thereā€™s cut-throat competition
  between the various libraries at the moment

ā€¢ This is one of the reasons I care about
  interoperability - commit to a single library
  and you might lose out when one of the
  others jumps ahead of it
The law of leaky abstractions
http://www.joelonsoftware.com/articles/LeakyAbstractions.html


My interpretation:


        The more you rely on
   abstractions, the worse off youā€™ll
     be when one of them leaks
Thank you!

More Related Content

What's hot

Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Libraryjeresig
Ā 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreRemy Sharp
Ā 
From YUI3 to K2
From YUI3 to K2From YUI3 to K2
From YUI3 to K2kaven yan
Ā 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
Ā 
Performance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptPerformance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptjeresig
Ā 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)jeresig
Ā 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
Ā 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup PerformanceGreg Whalin
Ā 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Domkaven yan
Ā 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
Ā 
Scalable vector ember
Scalable vector emberScalable vector ember
Scalable vector emberMatthew Beale
Ā 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)jeresig
Ā 
Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)jeresig
Ā 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009Robbie Cheng
Ā 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
Ā 
Ajax Security
Ajax SecurityAjax Security
Ajax SecurityJoe Walker
Ā 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery LibraryLearnNowOnline
Ā 
Javascript and Jquery Best practices
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practicesSultan Khan
Ā 
HTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsHTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsIvano Malavolta
Ā 

What's hot (20)

Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
Ā 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
Ā 
From YUI3 to K2
From YUI3 to K2From YUI3 to K2
From YUI3 to K2
Ā 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Ā 
Performance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptPerformance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScript
Ā 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
Ā 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
Ā 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
Ā 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
Ā 
JavaScript!
JavaScript!JavaScript!
JavaScript!
Ā 
Scalable vector ember
Scalable vector emberScalable vector ember
Scalable vector ember
Ā 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Ā 
Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)
Ā 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
Ā 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
Ā 
Ajax Security
Ajax SecurityAjax Security
Ajax Security
Ā 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
Ā 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
Ā 
Javascript and Jquery Best practices
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practices
Ā 
HTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsHTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile apps
Ā 

Viewers also liked

Ajaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µ
Ajaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µAjaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µ
Ajaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µFu Cheng
Ā 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to resultNikolai Onken
Ā 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
Ā 
Linked In Features Technical
Linked In Features TechnicalLinked In Features Technical
Linked In Features Technicalchomas kandar
Ā 
What the heck is HTML 5?
What the heck is HTML 5?What the heck is HTML 5?
What the heck is HTML 5?Simon Willison
Ā 
Building the Social Web with OpenID
Building the Social Web with OpenIDBuilding the Social Web with OpenID
Building the Social Web with OpenIDSimon Willison
Ā 
Web App Security Horror Stories
Web App Security Horror StoriesWeb App Security Horror Stories
Web App Security Horror StoriesSimon Willison
Ā 
Rediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesRediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesSimon Willison
Ā 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureSimon Willison
Ā 
When Ajax Attacks! Web application security fundamentals
When Ajax Attacks! Web application security fundamentalsWhen Ajax Attacks! Web application security fundamentals
When Ajax Attacks! Web application security fundamentalsSimon Willison
Ā 
DOM ( Document Object Model )
DOM ( Document Object Model )DOM ( Document Object Model )
DOM ( Document Object Model )ITSTB
Ā 
How Lanyrd does Geo
How Lanyrd does GeoHow Lanyrd does Geo
How Lanyrd does GeoSimon Willison
Ā 
OpenID at Open Tech 2008
OpenID at Open Tech 2008OpenID at Open Tech 2008
OpenID at Open Tech 2008Simon Willison
Ā 
Javascript and DOM
Javascript and DOMJavascript and DOM
Javascript and DOMBrian Moschel
Ā 
Document Object Model
Document Object ModelDocument Object Model
Document Object Modelchomas kandar
Ā 
Introduction to Browser Internals
Introduction to Browser InternalsIntroduction to Browser Internals
Introduction to Browser InternalsSiva Arunachalam
Ā 
Introduction to Browser DOM
Introduction to Browser DOMIntroduction to Browser DOM
Introduction to Browser DOMSiva Arunachalam
Ā 
Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuerySiva Arunachalam
Ā 

Viewers also liked (20)

Ajaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µ
Ajaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µAjaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µ
Ajaxåŗ”ē”Øå¼€å‘ęœ€ä½³å®žč·µ
Ā 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to result
Ā 
ScaleFail
ScaleFailScaleFail
ScaleFail
Ā 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
Ā 
Linked In Features Technical
Linked In Features TechnicalLinked In Features Technical
Linked In Features Technical
Ā 
What the heck is HTML 5?
What the heck is HTML 5?What the heck is HTML 5?
What the heck is HTML 5?
Ā 
Building the Social Web with OpenID
Building the Social Web with OpenIDBuilding the Social Web with OpenID
Building the Social Web with OpenID
Ā 
Web App Security Horror Stories
Web App Security Horror StoriesWeb App Security Horror Stories
Web App Security Horror Stories
Ā 
Rediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesRediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The Libraries
Ā 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Ā 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
Ā 
When Ajax Attacks! Web application security fundamentals
When Ajax Attacks! Web application security fundamentalsWhen Ajax Attacks! Web application security fundamentals
When Ajax Attacks! Web application security fundamentals
Ā 
DOM ( Document Object Model )
DOM ( Document Object Model )DOM ( Document Object Model )
DOM ( Document Object Model )
Ā 
How Lanyrd does Geo
How Lanyrd does GeoHow Lanyrd does Geo
How Lanyrd does Geo
Ā 
OpenID at Open Tech 2008
OpenID at Open Tech 2008OpenID at Open Tech 2008
OpenID at Open Tech 2008
Ā 
Javascript and DOM
Javascript and DOMJavascript and DOM
Javascript and DOM
Ā 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
Ā 
Introduction to Browser Internals
Introduction to Browser InternalsIntroduction to Browser Internals
Introduction to Browser Internals
Ā 
Introduction to Browser DOM
Introduction to Browser DOMIntroduction to Browser DOM
Introduction to Browser DOM
Ā 
Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuery
Ā 

Similar to Make libraries work for you with JavaScript frameworks

JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)jeresig
Ā 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)jeresig
Ā 
jQuery Presentation to Rails Developers
jQuery Presentation to Rails DevelopersjQuery Presentation to Rails Developers
jQuery Presentation to Rails DevelopersYehuda Katz
Ā 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesJazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesSimon Willison
Ā 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overviewjeresig
Ā 
How dojo works
How dojo worksHow dojo works
How dojo worksAmit Tyagi
Ā 
qooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Frameworkqooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Frameworkecker
Ā 
Learning jQuery @ MIT
Learning jQuery @ MITLearning jQuery @ MIT
Learning jQuery @ MITjeresig
Ā 
Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryMatt Butcher
Ā 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorialoscon2007
Ā 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)jeresig
Ā 
JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4alexsaves
Ā 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
Ā 
jQuery - Boston IxDA
jQuery - Boston IxDAjQuery - Boston IxDA
jQuery - Boston IxDAjeresig
Ā 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015jbandi
Ā 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
Ā 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascriptrajivmordani
Ā 
JavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQueryJavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQuerykatbailey
Ā 

Similar to Make libraries work for you with JavaScript frameworks (20)

JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)
Ā 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
Ā 
jQuery Presentation to Rails Developers
jQuery Presentation to Rails DevelopersjQuery Presentation to Rails Developers
jQuery Presentation to Rails Developers
Ā 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript librariesJazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Ā 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
Ā 
How dojo works
How dojo worksHow dojo works
How dojo works
Ā 
qooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Frameworkqooxdoo - Open Source Ajax Framework
qooxdoo - Open Source Ajax Framework
Ā 
Learning jQuery @ MIT
Learning jQuery @ MITLearning jQuery @ MIT
Learning jQuery @ MIT
Ā 
Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQuery
Ā 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
Ā 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)
Ā 
JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4
Ā 
Jquery
JqueryJquery
Jquery
Ā 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
Ā 
jQuery - Boston IxDA
jQuery - Boston IxDAjQuery - Boston IxDA
jQuery - Boston IxDA
Ā 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015
Ā 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
Ā 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascript
Ā 
Node azure
Node azureNode azure
Node azure
Ā 
JavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQueryJavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQuery
Ā 

More from Simon Willison

Cheap tricks for startups
Cheap tricks for startupsCheap tricks for startups
Cheap tricks for startupsSimon Willison
Ā 
The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)Simon Willison
Ā 
How we bootstrapped Lanyrd using Twitter's social graph
How we bootstrapped Lanyrd using Twitter's social graphHow we bootstrapped Lanyrd using Twitter's social graph
How we bootstrapped Lanyrd using Twitter's social graphSimon Willison
Ā 
Web Services for Fun and Profit
Web Services for Fun and ProfitWeb Services for Fun and Profit
Web Services for Fun and ProfitSimon Willison
Ā 
Tricks & challenges developing a large Django application
Tricks & challenges developing a large Django applicationTricks & challenges developing a large Django application
Tricks & challenges developing a large Django applicationSimon Willison
Ā 
Advanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Advanced Aspects of the Django Ecosystem: Haystack, Celery & FabricAdvanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Advanced Aspects of the Django Ecosystem: Haystack, Celery & FabricSimon Willison
Ā 
How Lanyrd uses Twitter
How Lanyrd uses TwitterHow Lanyrd uses Twitter
How Lanyrd uses TwitterSimon Willison
Ā 
Building Things Fast - and getting approval
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approvalSimon Willison
Ā 
Building crowdsourcing applications
Building crowdsourcing applicationsBuilding crowdsourcing applications
Building crowdsourcing applicationsSimon Willison
Ā 
Evented I/O based web servers, explained using bunnies
Evented I/O based web servers, explained using bunniesEvented I/O based web servers, explained using bunnies
Evented I/O based web servers, explained using bunniesSimon Willison
Ā 
Cowboy development with Django
Cowboy development with DjangoCowboy development with Django
Cowboy development with DjangoSimon Willison
Ā 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with DjangoSimon Willison
Ā 
Class-based views with Django
Class-based views with DjangoClass-based views with Django
Class-based views with DjangoSimon Willison
Ā 
Web Security Horror Stories
Web Security Horror StoriesWeb Security Horror Stories
Web Security Horror StoriesSimon Willison
Ā 
When Zeppelins Ruled The Earth
When Zeppelins Ruled The EarthWhen Zeppelins Ruled The Earth
When Zeppelins Ruled The EarthSimon Willison
Ā 
I love Zeppelins, and you should too
I love Zeppelins, and you should tooI love Zeppelins, and you should too
I love Zeppelins, and you should tooSimon Willison
Ā 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
Ā 
URL-based identity with OpenID
URL-based identity with OpenIDURL-based identity with OpenID
URL-based identity with OpenIDSimon Willison
Ā 

More from Simon Willison (20)

Cheap tricks for startups
Cheap tricks for startupsCheap tricks for startups
Cheap tricks for startups
Ā 
The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)
Ā 
Building Lanyrd
Building LanyrdBuilding Lanyrd
Building Lanyrd
Ā 
How we bootstrapped Lanyrd using Twitter's social graph
How we bootstrapped Lanyrd using Twitter's social graphHow we bootstrapped Lanyrd using Twitter's social graph
How we bootstrapped Lanyrd using Twitter's social graph
Ā 
Web Services for Fun and Profit
Web Services for Fun and ProfitWeb Services for Fun and Profit
Web Services for Fun and Profit
Ā 
Tricks & challenges developing a large Django application
Tricks & challenges developing a large Django applicationTricks & challenges developing a large Django application
Tricks & challenges developing a large Django application
Ā 
Advanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Advanced Aspects of the Django Ecosystem: Haystack, Celery & FabricAdvanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Advanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Ā 
How Lanyrd uses Twitter
How Lanyrd uses TwitterHow Lanyrd uses Twitter
How Lanyrd uses Twitter
Ā 
Building Things Fast - and getting approval
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approval
Ā 
Building crowdsourcing applications
Building crowdsourcing applicationsBuilding crowdsourcing applications
Building crowdsourcing applications
Ā 
Evented I/O based web servers, explained using bunnies
Evented I/O based web servers, explained using bunniesEvented I/O based web servers, explained using bunnies
Evented I/O based web servers, explained using bunnies
Ā 
Cowboy development with Django
Cowboy development with DjangoCowboy development with Django
Cowboy development with Django
Ā 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with Django
Ā 
Django Heresies
Django HeresiesDjango Heresies
Django Heresies
Ā 
Class-based views with Django
Class-based views with DjangoClass-based views with Django
Class-based views with Django
Ā 
Web Security Horror Stories
Web Security Horror StoriesWeb Security Horror Stories
Web Security Horror Stories
Ā 
When Zeppelins Ruled The Earth
When Zeppelins Ruled The EarthWhen Zeppelins Ruled The Earth
When Zeppelins Ruled The Earth
Ā 
I love Zeppelins, and you should too
I love Zeppelins, and you should tooI love Zeppelins, and you should too
I love Zeppelins, and you should too
Ā 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
Ā 
URL-based identity with OpenID
URL-based identity with OpenIDURL-based identity with OpenID
URL-based identity with OpenID
Ā 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhisoniya singh
Ā 
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Ā 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
Ā 
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024BookNet Canada
Ā 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
Ā 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
Ā 
Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...Patryk Bandurski
Ā 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
Ā 
#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024BookNet Canada
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
Ā 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
Ā 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
Ā 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
Ā 
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...Alan Dix
Ā 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
Ā 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
Ā 
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
Ā 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Ā 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Ā 
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Ā 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
Ā 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
Ā 
Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleĀ Integration and Automat...
Ā 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
Ā 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Ā 
#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Ā 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Ā 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Ā 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Ā 
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Swan(sea) Song ā€“ personal research during my six years at Swansea ... and bey...
Ā 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
Ā 

Make libraries work for you with JavaScript frameworks

  • 1. How to make libraries work for you Simon Willison - http://simonwillison.net/ Web 2.0 Expo Berlin 7th November 2007
  • 2. This talk ā€¢ JavaScript libraries! ā€¢ What they are ā€¢ Why they exist ā€¢ What they can do for you ā€¢ How to pick one
  • 3. JavaScript libraries ā€¢ ajaxpatterns.org lists over 40 general purpose JavaScript libraries ā€¢ ... and thatā€™s not including the many libraries tied to a speciļ¬c server-side language ā€¢ Why are there so many of them?
  • 4. ā€œThe bad news: JavaScript is broken. The good news: It can be ļ¬xed with more JavaScript!ā€ Geek folk saying
  • 5. ā€¢ Inconsistent event model (thanks, IE) ā€¢ Memory management (thanks, IE) ā€¢ The DOM is a horrible API! ā€¢ JavaScript-the-language has quite a few warts ā€¢ But itā€™s powerful enough to let you ļ¬x them ā€¢ Browser Ajax is far too verbose ā€¢ Positioning and co-ordinates ā€¢ Drag and drop and Animation are really hard
  • 6. var xhr; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { xhr = new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) {} } xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { alert(xhr.responseText); } else { alert('Error code ' + xhr.status); } } }
  • 7. Narrowing them down... ā€¢ Prototype (and Scriptaculous) ā€¢ The Yahoo! User Interface Library - YUI ā€¢ jQuery ā€¢ The Dojo Toolkit
  • 8. Download Get the latest versionā€”1.5.1 Learn Prototype is a JavaScript Framework that aims to Online documentation and resources. ease development of dynamic web applications. Featuring a unique, easy-to-use toolkit for class-driven Discuss development and the nicest Ajax library around, Prototype Mailing list and IRC is quickly becoming the codebase of choice for web application developers everywhere. Contribute Submit patches and report bugs. Prototype and Scriptaculous Prototype and script.aculo.us: The quot;Bungee bookquot; has landed! Core team member Christophe Who's using Prototype? Meet the developers Porteneuve has been hard at work for the past few months tracking
  • 9. ā€¢ Prototype focuses on basic browser compatibility and JavaScript language enhancement ā€¢ It tries to make JavaScript more like Ruby ā€¢ Extends most of JavaScriptā€™s built-in objects with new functionality ā€¢ Scriptaculous adds fancy effects, basic widgets and drag and drop
  • 10. ā€¢ $, $$, $F, $A, $H ā€¢ var Animal = Class.create(...) ā€¢ new Ajax.Request(url[, options]) ā€¢ Event.observe(el, 'click', function() { ... }) ā€¢ quot;foo-barquot;.camelize() -> quot;fooBarquot;
  • 11. $$('#bmarks li').each(function(li){ Event.observe(li, 'click', function(e) { this.style.backgroundColor = 'yellow'; }.bindAsEventListener(li)); });
  • 12. Script.aculo.us ā€¢ Wizzy extension for Prototype ā€¢ Huge collection of packaged effects ā€¢ AutoComplete, Slider, InPlaceEditor controls ā€¢ Drag and drop
  • 13. The Yahoo UI Library
  • 14. ā€¢ Created at Yahoo!, BSD licensed ā€¢ Designed for both creating new applications and integration with legacy code ā€¢ Focused on browser issues; almost no functionality relating to JS language itself ā€¢ Extensively tested and documented
  • 15. controls autocomplete calendar container menu slider treeview animation dragdrop dom event connection utilities
  • 16. YAHOO.util.Event.on(window, 'load', function() { var div = YAHOO.util.Dom.get('messages'); setTimeout(function() { var anim = new YAHOO.util.Anim(div, { height: {to: 0}, opacity: {to: 0} }, 0.4); anim.animate(); anim.onComplete.subscribe(function() { div.parentNode.removeChild(div); }); }, 2000); });
  • 17. Common YUI idiom $E = YAHOO.util.Event; $D = YAHOO.util.Dom; $E.on(window, 'load', function() { var div = $D.get('messages'); ... });
  • 19. ā€¢ Simple philosophy: ļ¬nd some nodes, then do something to them ā€¢ Minimal impact on your global namespace - it adds two global symbols: jQuery and $, and $ can be easily reverted ā€¢ API designed around ā€œchainingā€ - other libraries are now emulating this ā€¢ Outstanding node selection, based on CSS 3 and custom extensions ā€¢ Small core library with a smart plugin mechanism
  • 20. jQuery(window).ready(function() { jQuery(quot;div.hideablequot;). css('cursor', 'pointer'). append('<p>Click to hide</p>'). click(function() { jQuery(this).hide(quot;slowquot;); return false; }); });
  • 21. $(function() { $(quot;div.hideablequot;). css('cursor', 'pointer'). append('<p>Click to hide</p>'). click(function() { $(this).hide(quot;slowquot;); return false; }); });
  • 23. ā€¢ The oldest of the current popular libraries, pre-dating even the term ā€œAjaxā€ ā€¢ Incredible amounts of functionality ā€¢ Used to suffer from a tough learning curve, but the 1.0 release greatly simpliļ¬es things
  • 24. dojo.collections dojo.math dojo.crypto dojo.reļ¬‚ect dojo.date dojo.rpc dojo.dnd dojo.storage dojo.dom dojo.string dojo.event Dojo 0.4 dojo.style dojo.io dojo.undo dojo.lang dojo.uri dojo.lfx dojo.widget dojo.logging dojo.xml http://www.ļ¬‚ickr.com/photos/aprillynn77/8818200/
  • 25. dojo Dojo 1.0 dojox dijit
  • 26. Dojo components ā€¢ dojo ā€¢ Core library, similar to jQuery / Prototype ā€¢ Dynamic code loading and dependency management ā€¢ dijit ā€¢ Advanced widget system ā€¢ dojox ā€¢ Dojo eXperimental - crazy voodoo magic
  • 27. dijit
  • 28.
  • 29. <div dojoType=quot;dijit.layout.TabContainerquot; sizeShare=quot;40quot;> <div id=quot;tab1quot; dojoType=quot;dijit.layout.ContentPanequot; title=quot;Form Feelquot;> <h2>Various Form Elements:</h2> <form name=quot;dijitFormTestquot;> <p><input type=quot;checkBoxquot; dojoType=quot;dijit.form.CheckBoxquot; checked=quot;checkedquot;> Standard Dijit CheckBox <br><input type=quot;checkBoxquot; dojoType=quot;dijit.form.CheckBoxquot; disabled=quot;disabledquot;> Disabled Dijit <br> <input type=quot;checkBoxquot; dojoType=quot;dijit.form.CheckBoxquot; disabled=quot;disabledquot; checked=quot;checkedquot;> Checked and Disabled Dijit </p> ...
  • 30. dojox
  • 31. ā€¢ Graphics (cross-browser drawing API) ā€¢ Ofļ¬‚ine storage ā€¢ Cryptography ā€¢ Templating ā€¢ Data grids and more ā€¢ ā€œThe future of the browser todayā€
  • 34. The Google Web Toolkit
  • 35. What are the interesting ideas?
  • 37. Smart node selection ā€¢ Any JavaScript that modiļ¬es the page inevitably starts out by selecting some existing nodes ā€¢ jQuery is based entirely around node selection ā€¢ Prototype and Dojo also have node selection APIs
  • 38. Smarter Ajax ā€¢ Prototype makes it easy to set a callback for when ANY Ajax request completes... useful for loading status icons ā€¢ Ajax.Updater can extract and execute <script> blocks in HTML fragments ā€¢ Great for unobtrusively enhancing elements that have just been added to the page
  • 39. Self-adjusting animations ā€¢ You can roll your own animations in JavaScript using setTimeout and setInterval... ā€¢ ... but the time taken for a animation will vary depending on browser performance ā€¢ Smarter animations adjust their framerate to compensate for browser performance ā€¢ All four libraries do this
  • 40. DSLs for animation var anim = new YAHOO.util.Anim('el', { opacity: {to: 0.5}, height: {to: 0}, fontSize: { from: 100, to: 50, unit: '%' } }, 1); anim.animate();
  • 41. XPath optimisations ā€¢ Mozilla and Opera offer fast XPath lookups through document.evaluate(...) ā€¢ Dojo can use this for getElementsByClass() ā€¢ Prototype redeļ¬nes getElementsBySelector to use XPath
  • 42. Miniļ¬cation ā€¢ All four libraries ship in both uncompressed and compressed formats ā€¢ YUI uses miniļ¬cation: whitespace and comments are stripped ā€¢ The Dojo build system uses ā€œShrinkSafeā€, which compresses JavaScript using the Rhino parser ā€¢ jQuery uses Dean Edwardsā€™ Packer, with base62 encoding
  • 43. Hosting on a CDN http://yui.yahooapis.com/2.2.2/build/reset/reset-min.css http://yui.yahooapis.com/2.2.2/build/dom/dom-min.js ... http://o.aolcdn.com/iamalpha/.resource/jssdk/dojo-0.4.1/dojo.js ā€¢ JavaScript is cached before the user even visits your site
  • 44. So how do you pick one?
  • 45. So how do you pick one? ā€¢ It depends on what you are trying to build
  • 46.
  • 47. My library selection criteria ā€¢ Enables unobtrusive JavaScript ā€¢ Plays well with other code ā€¢ Smart use of namespacing ā€¢ Global variable impact kept to a minimum ā€¢ Tie breaker: the less code I have to write the better!
  • 48. ā€¢ Iā€™m currently using and recommending jQuery for most situations ā€¢ But... thereā€™s cut-throat competition between the various libraries at the moment ā€¢ This is one of the reasons I care about interoperability - commit to a single library and you might lose out when one of the others jumps ahead of it
  • 49. The law of leaky abstractions
  • 50. http://www.joelonsoftware.com/articles/LeakyAbstractions.html My interpretation: The more you rely on abstractions, the worse off youā€™ll be when one of them leaks